package longshu.data.common;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.io.Serializable;
import java.util.Date;

/**
 * BaseEnity
 *
 * @author LongShu 2018/01/18
 */
@Getter
@Setter
@Accessors(chain = false)
public class BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * <pre>
     * 1.全部数据库通用的@GeneratedValue(generator="UUID")
     * 2.useGeneratedKeys的@GeneratedValue(generator="JDBC")
     * 3.类似mysql数据库的@GeneratedValue(strategy=GenerationType.IDENTITY[,generator="Mysql"])
     * </pre>
     */
    @Id
    @GeneratedValue(generator = "JDBC")
    protected Integer id;

    /**
     * 创建时间
     */
    @Column(name = "gmt_create")
    @Temporal(TemporalType.TIMESTAMP)
    protected Date gmtCreate;
    /**
     * 修改时间
     */
    @Column(name = "gmt_modified")
    @Temporal(TemporalType.TIMESTAMP)
    protected Date gmtModified;

    /**
     * 是否有效
     */
    @Column(name = "yn")
    protected Boolean yn = Boolean.TRUE;

}
